class Valleyers::Show::Albums::Show::Photos::Show::ScansController < ApplicationController
  def index
    @valleyer = Valleyer.find params[:valleyer_id]
    @album = Album.find params[:album_id]
    @photo = Photo.find params[:photo_id]
    #初始化相片评论
    @post = Post.new :photo_id => params[:photo_id],
      :created_by_valleyer_id => current_valleyer_id
  end

  def show
    @photo = Photo.find params[:id]
  end

  def destroy
    @photo = Photo.find params[:id]
    @valleyer = @photo.author
    @album = @photo.album
    @photo.destroy
    @photo = Photo.find_last_by_album_id @album.id
    #初始化相片评论
    @post = Post.new :photo_id => @photo.id,
      :created_by_valleyer_id => current_valleyer_id
  end

  def authorize

  end
end
